package tool

import (
	"beetle/internal/pkg/constant"
)

// Response restful响应
type Response struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Info interface{} `json:"info"`
}

// Success 默认成功
func Success() Response {
	return Response{
		Code: constant.SUCCESS_CODE,
	}
}

// Data 返回数据
func Data(data interface{}) Response {
	return Response{
		Code: constant.SUCCESS_CODE,
		Info: data,
	}
}

// Fail 默认失败信息
func Fail(msg string) Response {
	return Response{
		Code: constant.FAIL_CODE,
		Msg:  msg,
	}
}
